package SQL.abysnSQL;

/*
 * 	bool-expr ::= value cop value
                 | bool-expr AND bool-exp
				 | bool-expr OR bool-exp
				 | [NOT] EXISTS (subquery)
				 | value cop ANY (supquery)
				 | value IN (subquery)
				 | value op ALL (subquery)	
 */

public class BoolCondition {
	public BoolCondition leftB,rightB;
	public Value leftV,rightV;
	public Cop cop;
	public SQL subquery;
	public TYPE type;
	
	public static enum TYPE{
		VALUE,AND,OR,EXIST,NOTEXIST,ANY,IN,ALL
	}
	
	public BoolCondition(Value l,Cop op, Value r){
		leftV = l;
		cop = op;
		rightV = r;
		type = TYPE.VALUE;
	}
	
	public BoolCondition(SQL s,boolean ex){
		subquery = s;
		if(ex)
			type = TYPE.EXIST;
		else
			type = TYPE.NOTEXIST;
	}
	

	public BoolCondition(Value v,Cop o,SQL s,boolean all){
		leftV = v;
		cop = o;
		subquery = s;
		if(all)
			type = TYPE.ALL;
		else
			type = TYPE.ANY;
		}
	
	public BoolCondition(Value v,SQL s){
		leftV = v;
		subquery = s;
		type = TYPE.IN;
	}
	
	public BoolCondition(BoolCondition l, BoolCondition r,boolean and){
		leftB = l;
		rightB = r;
		if(and)
			type = TYPE.AND;
		else
			type = TYPE.OR;
	}
	
	//TODO
}
